#include <iostream>
#include<stdlib.h>


using namespace std;

class Cstring{
public:
    Cstring(const char* str);
    ~Cstring();
    void display(){cout<<p<<endl;}
private: 
    char* p;
};

Cstring::Cstring(const char* str)
{
    p=new char[strlen(str)+1];
    strcpy(p,str);
    cout<<"construct"<<str<<endl;
}

Cstring::~Cstring()
{
    cout<<"destruct"<<endl;
    delete []p;
}

int main()
{
    Cstring s1("C++"), s2="Javascript";
    s1.display();
    s2.display();
    
    system("pause");
    return 0;
}
